<?php

class ContactController extends Zend_Controller_Action
{

    public function indexAction()
    {
    	$this->view->form = new Application_Form_Contact( );
    	$this->view->thankYouPage = false;
	    if($this->_request->isPost( )){
	      	if($this->view->form->isValid( $this->_request->getPost( ))){
	      		$_table = new Application_Model_DbTable_Contacts( );
	      		$contactDetails = $this->view->form->getValues( );
	      		$_table->insert($contactDetails);
	      		
	      		$model = new Application_Model_Contacts();
	      		$model->sendMail($contactDetails);
	      		$this->view->thankYouPage = true;
	      	}
	     }
     }
}

